#include "dllSymbol.h"

int dll_symbol_list_add_head(dll_symbol_list **ppHead, dll_symbol_list *pNode)
{
    if (NULL == pNode)
        return -1;

    pNode->next = *ppHead;
    *ppHead = pNode;

    return 0;
}

int dll_symbol_list_delete_head(dll_symbol_list **ppHead)
{
    dll_symbol_list *headSymbol = *ppHead;

    if (*ppHead == NULL)
        return -1;

    *ppHead = (*ppHead)->next;

    free(headSymbol->data);
    free(headSymbol);

    return 0;
}

int dll_symbol_list_delete_all(dll_symbol_list **ppHead)
{
    dll_symbol_list *headSymbol = NULL;

    while (*ppHead) {
        headSymbol = *ppHead;
        *ppHead = (*ppHead)->next;
        free(headSymbol->data);
        free(headSymbol);
    }

    return 0;
}
